package vn.conghuy.talkwithme.data;

import java.util.ArrayList;

import vn.conghuy.talkwithme.utils.Utils;

public class AppPackageInfo {
	/**
	 * @uml.property  name="packageName"
	 */
	String packageName;
	/**
	 * @uml.property  name="keywords"
	 * @uml.associationEnd  multiplicity="(0 -1)" elementType="java.lang.String"
	 */
	ArrayList<String> keywords;
	
	public AppPackageInfo() {
		super();
		keywords = new ArrayList<String>();
	}
	
	public AppPackageInfo(String packageName) {
		super();
		keywords = new ArrayList<String>();
		this.packageName = packageName;
	}
	
	public void insertKeyword(String... keys){
		for(String key:keys){
			keywords.add(key);
		}
	}

	/**
	 * @return
	 * @uml.property  name="packageName"
	 */
	public String getPackageName() {
		return packageName;
	}

	/**
	 * @param packageName
	 * @uml.property  name="packageName"
	 */
	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}

	public ArrayList<String> getKeywords() {
		return keywords;
	}

	public void setKeywords(ArrayList<String> keywords) {
		this.keywords = keywords;
	}
	
	public boolean isValid(){
		if(keywords.size() > 0 && packageName != null){
			return true;
		}
		return false;
	}
	
	public boolean isExistKeywordBeWordInPhrase(String phrase){
		return Utils.isExistElemInArrayIsWordOfStr(keywords, phrase, null);
	}
}
